import request from '@/utils/request'
/**
 * 获取组织架构数据
 * **/
export function getDepartments() {
  return request({
    url: '/company/department'
  })
}
/**
 * 删除组织架构
 * @param {*} id 部门id
 * @returns
 */
export function delDepartment(id) {
  return request({
    method: 'DELETE',
    url: `/company/department/${id}`
  })
}
/**
 * 新增子部门
 * @param {Object} 要准备的数据选项
 */
export function addDepartments(data) {
  return request({
    url: '/company/department',
    method: 'post',
    data
  })
}

/**
 *  编辑部门
 * @param {Object} 要准备的数据选项
 */
export function editDepartments(data) {
  return request({
    url: `/company/department/${data.id}`,
    method: 'put',
    data
  })
}
